import Vue from "vue";
import VueRouter from "vue-router";
import login from "../views/login.vue"
import index from "../views/index.vue"
import dashboard from '../components/dashboard.vue'

import goods from '../components/goods/goods.vue'
import goodscategory from '../components/goods/goodscategory.vue'
import goodslist from '../components/goods/goodslist.vue'
import upsert from '../components/goods/upsert.vue'

import operate from '../components/operate/operate.vue'
import commentmanage from '../components/operate/commentmanage.vue'
import freightmanage from '../components/operate/freightmanage.vue'
import ordermanage from '../components/operate/ordermanage.vue'

import promotion from '../components/promotion/promotion.vue'
import couponmanage from '../components/promotion/couponmanage.vue'
import recommanage from '../components/promotion/recommanage.vue'
import shopadvert from '../components/promotion/shopadvert.vue'
import shopsmanage from '../components/promotion/shopsmanage.vue'

import system from '../components/system/system.vue'
import adminlist from '../components/system/adminlist.vue'
import rolemanage from '../components/system/rolemanage.vue'
import usermanage from '../components/system/usermanage.vue'


import page from '../components/page.vue'

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		redirect: '/login'
	},
	{
		path: '/login',
		name: "login",
		component: login,
	},
	{
		path: '/index',
		name: "首页",
		component: index,
		redirect: '/dashboard',
				children: [
					{
					path: '/dashboard',
					name: "首页",
					component: dashboard
					},
			// 商品管理
			{
				path: '/goods',
				name: "商品管理",
				component: goods,
				children: [{
					path: '/goods/goodscategory',
					name: "商品类目",
					component: goodscategory,
				}, {
					path: '/goods/goodslist',
					name: "商品列表",
					component: goodslist,
				},{
					path: '/goods/upsert',
					name: "商品编辑",
					component: upsert,
				}],
			},
			// 运营管理
			{
				path: '/operate',
				name: "运营管理",
				component: operate,
				children: [{
					path: '/operate/commentmanage',
					name: "评论管理",
					component: commentmanage,
				}, {
					path: '/operate/freightmanage',
					name: "运费模板管理",
					component: freightmanage,
				}, {
					path: '/operate/ordermanage',
					name: "订单管理",
					component: ordermanage,
				}],
			},
			// 推广管理
			{
				path: '/promotion',
				name: "推广管理",
				component: promotion,
				children: [{
					path: '/promotion/couponmanage',
					name: "优惠券管理",
					component: couponmanage,
				}, {
					path: '/promotion/recommanage',
					name: "推荐管理",
					component: recommanage,
				}, {
					path: '/promotion/shopadvert',
					name: "商铺广告",
					component: shopadvert,
				}, {
					path: '/promotion/shopsmanage',
					name: "商铺信息",
					component: shopsmanage,
				}],
			},
			// 系统管理
			{
				path: '/system',
				name: "系统管理",
				component: system,
				children: [{
					path: '/system/adminlist',
					name: "管理员",
					component: adminlist,
				}, {
					path: '/system/rolemanage',
					name: "角色管理",
					component: rolemanage,
				}, {
					path: '/system/usermanage',
					name: "会员管理",
					component: usermanage,
				}],
			}

		]
	},{
		path:'/page',
		name:'空白页',
		component: page,
	}

];

const router = new VueRouter({
	mode: "history",
	base: process.env.BASE_URL,
	routes,
});

export default router;
